home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / m4-1_0_3.lha / m4-1.0.3 / examples / capitalize.m4 next >
M4 Source File  |  1990-11-08  |  332b  |  9 lines

  1. dnl
  2. dnl convert to upper- resp. lowercase
  3. define(`upcase', `translit(`$*', `a-z', `A-Z')')
  4. define(`downcase', `translit(`$*', `A-Z', `a-z')')
  5. dnl
  6. dnl capitalize a single word
  7. define(`capitalize1', `regexp(`$1', `^\(\w\)\(\w*\)', `upcase(`\1')`'downcase(`\2')')')
  8. define(`capitalize', `patsubst(`$1', `\w+', ``'capitalize1(`\0')')')
  9.